<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>商家认证</title>
    <script src="../js/mui.min.js"></script>
	<link href="../css/mui.min.css" rel="stylesheet" />
	<link rel="stylesheet" href="../css/iconfont.css" />
	<link rel="stylesheet" href="../css/style.css" />
	<link rel="stylesheet" href="../css/member.css" />
	<link rel="stylesheet" href="../css/picker.css" />
	<link rel="stylesheet" href="../css/poppicker.css" />	
	<script src="../plugin/crop/croppie.min.js"></script>
	<link rel="stylesheet" href="../css/font-awesome.min.css" />
	<link rel="stylesheet" href="../css/bootstrap.min.css" />
	<style type="text/css">
		#sfz_pic{position: relative;}/*opacity: 0;*/
		 .upload,.upload1{position: absolute;top: 0;left: 0;width: 100%;height: 100%;opacity: 0;}
		#dp_pic{position: relative;}
		 .upload2{position: absolute;top: 0;left: 0;width: 100%;height: 100%;opacity: 0;}
		#yyzz_pic{position: relative;}
		 .upload3{position: absolute;top: 5%;left: 6%;height: 100%;width: 100%;opacity: 0;}
		#qt_pic{position: relative;}
		 .upload4{position: absolute;top: 5%;left: 6%;height: 100%;width: 100%;opacity: 0;}
		.renz_box{width: 94%; margin-top: 10px; padding-bottom: 0px;}
		.renz_box li{background: #fff7f1; border: 1px solid #FE9956; border-radius: 10px; color: #666666;}
		.renz_box li:last-child{margin-bottom: 10px;}
		.sqrz_bt{font-size: 14px; text-align: center; padding-top: 20px; color: #666666; padding: 15px 3% 0;}
		.mui-input-group:after{height: 0;}
	</style>
</head>
<body>
	<header class="mui-bar mui-bar-nav">
	    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" href="JavaScript:history.go(-1)"></a>
	    <h1 class="mui-title">商家认证 </h1>
	</header>
	<div class="mui-content " style="background: #fff;">
			<canvas width="500" height="800" id="canvas" style="display: none;"></canvas>
	   	<div class="gerenzl_nr">
	   		 <form class="mui-input-group gerenzl_group">
	   		 	<div class="mui-input-row" id="status_row" style="display: none;">
					<div style="text-align: center;font-size: 18px;" id="status">审核未通过:<em style="color: red;" id="reason">原因</em></div>
				</div>
	   		 	<div class="mui-input-row">
					<label>开户分行</label>
					<input type="text" id="bank_account" class="mui-input-group" placeholder="请输入开户银行名称">					
				</div>
				<div class="mui-input-row">
					<label>卡号</label>
					<input type="text" id="card_no" class="mui-input-group" placeholder="请输入卡号">					
				</div>
				<div class="mui-input-row">
					<label>开户人</label>
					<input type="text" id="bank_username" class="mui-input-group" placeholder="请输入开户人姓名">		
				</div>
				<div class="mui-input-row">
					<label>银行手机号码</label>
					<input type="text" id="bank_mobile" class="mui-input-group" placeholder="请输入预留手机号码" >		
				</div>
				<div class="mui-input-row">
					<label>身份证号</label>
					<input type="text" id="idcard" class="mui-input-group" placeholder="请输入身份证号">		
				</div>
				<div class="sqrz_bt">开户人必须跟身份证姓名一样，不然通不过</div>
				<div class="sqrz_bt" style="padding-top: 5px;">您的图片仅用于审核，我们将为您严格保密</div>
				<ul class="renz_box clearfix">
		    		<li>
		    			<div class="renz_img " id="yyzz_pic" >
		    				<input type="hidden" name="card1" id="card1" />
		    				<input type="file" id="upload" class="upload1" value="选择图片文件" multiple />
		    				<span><img class='img_1' id='img_list' src="../images/renz.jpg"></span>
		    			</div>
		    			<div>上传身份证正面照片</div>
		    		</li>
		    		<li>
		    			<div class="renz_img " id="yyzz_pic" >
		    				<input type="hidden" name="card2" id="card2" />
		    				<input type="file" id="upload4" class="upload1" value="选择图片文件" multiple />
		    				<span><img class='img_4' id='img_list' src="../images/renz2.jpg"></span>
		    			</div>
		    			<div>上传身份证反面照片</div>
		    		</li>
		    		<li>
		    			<div class="renz_img " id="yyzz_pic" >
		    				<input type="hidden" name="card3" id="card3" />
		    				<input type="file" id="upload5" class="upload1" value="选择图片文件" multiple />
		    				<span><img class='img_5' id='img_list' src="../images/renz3.jpg"></span>
		    			</div>
		    			<div>上传个人半身照片</div>
		    		</li>
		    		<li id="yy_pic">
		    			<div class="renz_img" id="qt_pic">	  
		    				<input type="hidden" name="license" id="license" />
		    				<input type="file" id="upload1" class="upload" value="选择图片文件" multiple />
		    				<span><img class='img_2' id='img_list' src="../images/renz5.jpg"></span>	    				
		    			</div>
		    			<div>上传营业执照照片</div>
		    		</li>
		    		<li>
		    			<div class="renz_img" id="qt_pic">	  
		    				<input type="hidden" name="bank_img" id="bank_img" />
		    				<input type="file" id="upload2" class="upload" value="选择图片文件" multiple />
		    				<span><img class='img_3' id='img_list' src="../images/renz4.jpg"></span>	    				
		    			</div>
		    			<div>上传银行卡正面照片</div>
		    		</li>
		    	</ul>
		    	<div class="mui-input-row">
					通过认证：可以使用广告佣金转余额，余额T+1自动提现，手动D+0提现功能。	
				</div>
				<div class="sqrz_bt" style="display: none;">111</div>
				<input type="hidden" name="property" id="property" />
			</form>
			
			 	
	   	</div>
	  <button class="gerzl_btn" id="btn" style="color: #fff;font-weight: bold;font-size: 16px;">提交申请</button>
	  <div class="gerzl_btn" id="sh_status" style="display: none; color: #f1ecec;font-size: 16px;font-weight: bold;"></div>
	</div>
	
	
</body>
</html>
		<script type="text/javascript" src="../js/jquery.min.js"></script>
		<script type="text/javascript" src="../js/bootstrap-datepicker.js"></script>
		<script src="../js/layer/layer.min.js"></script>
		<script src="../js/castapp.js"></script>
		
		<script src="../js/picker.js"></script>
		<script src="../js/poppicker.js"></script>
		<script src="../js/city.data-3.js"></script>
		<script src="../js/bootstrap.min.js"></script>
		<script src="../js/app.js"></script>
	<script>
		ca.init();
		//back_login();
		var index = layer.load(0, {
				shade: false,
				time: 1000
			});
		
		$(function(){
			var member = JSON.parse(localStorage.getItem('member'));
			$.ajax({
				url: APP.api_url + 'agent/get_u_agent',
				data: {
					token: member['token'],
					uid: getUid()
				},
				success: function(data) {
					if(data.agent){
						var json = data.agent;
						$("#property").val(json.store_property);
						if(json.store_property==1){
							$("#yy_pic").hide();
						}
					}
				}
			});
		})
		
		
		
		$(".layui-layer-loading").css("left", "45%");
		$(function () {
				$('#upload').on('change', function() {
					$('#sh_status').hide();
					$('#btn').show();
					$('.img_1').attr('src','');
					readFile1(this,"card1",1);
				});
				$('#upload4').on('change', function() {
					$('#sh_status').hide();
					$('#btn').show();
					$('.img_4').attr('src','');
					readFile1(this,"card2",1);
				});
				$('#upload5').on('change', function() {
					$('#sh_status').hide();
					$('#btn').show();
					$('.img_5').attr('src','');
					readFile1(this,"card3",1);
				});
				$('#upload1').on('change', function() {
					$('#sh_status').hide();
					$('#btn').show();
					$('.img_2').attr('src','');
					readFile1(this,"license",1);
				});
				$('#upload2').on('change', function() {
					$('#sh_status').hide();
					$('#btn').show();
					$('.img_3').attr('src','');
					readFile1(this,"bank_img",1);
				});
				set_img();
			});
			function set_img(){
			 $.ajax({
				    type: 'post',
				    url: APP.api_url + 'agent/get_u_agent',
				    data: {uid:getUid(),token:get_token()},
				    success: function(data) {
						var agent=data.agent;
						$('#bank_account').val(agent['bank_account']);
						$('#card_no').val(agent['card_no']);
						$('#bank_username').val(agent['bank_username']);
						$('#bank_mobile').val(agent['bank_mobile']);
						$('#idcard').val(agent['idcard']);
						if(agent['is_credentials']==2){
							$("#btn").hide();
							$("#sh_status").text("审核已通过");
							$("#sh_status").show();
						}else if(agent['is_credentials']==1){
							$("#btn").hide();
							$("#sh_status").text("审核中");
							$("#sh_status").show();
						}else if(agent['is_credentials']==3){
							$("#status_row").show();
							$("#sh_status").html("审核未通过");
							$("#reason").html(""+agent['reason']);
						}
						if(agent['is_credentials']!=0){
							$("#card1").val(agent['card1']);
							$("#card2").val(agent['card2']);
							$("#card3").val(agent['card3']);
							$("#license").val(agent['license']);
							$('#bank_img').val(agent['bank_img']);
							var pic_url1 = user_tupian(agent['card1'],'../images/renz.jpg'); 
							var pic_url2 = user_tupian(agent['card2'],'../images/renz2.jpg');
							var pic_url3 = user_tupian(agent['card3'],'../images/renz3.jpg');
							var pic_url4 = user_tupian(agent['license'],'../images/renz4.jpg');
							var pic_url5 = user_tupian(agent['bank_img'],'../images/renz5.jpg');
							$(".img_1").attr('src',pic_url1);
							$('#card1').val(agent['card1']);
							
							
							$(".img_4").attr('src',pic_url2);
							$('#card2').val(agent['card2']);
							
							
							$(".img_5").attr('src',pic_url3);
							$('#card3').val(agent['card3']);
							
							
							$(".img_2").attr('src',pic_url4);
							$('#license').val(agent['license']);
							
							
							$(".img_3").attr('src',pic_url5);
							$('#bank_img').val(agent['bank_img']);
							
							
							$(".file-btn").hide();
							var cls="";
							var x="";
							if(agent['is_credentials']==3){
								cls="del";
								x="x";
							}
						}
				    }
				});
			
		}var input = ca.tagName('input');
		var imgs = ca.className("gr-img");
		var imgclick = ca.className('img-click');
		var myreg = /^1[3578]\d{9}$/; 
		$("#btn").on('click', function() {
			$('#btn').attr("disabled",true);
			var card1	=	$("#card1").val();
			var card2	=	$("#card2").val();
			var card3	=	$("#card3").val();
			var license	=	$("#license").val();
			var bank_img	=	$("#bank_img").val();
			var bank_username=$('#bank_username').val();
			var card_no=$('#card_no').val();
			var bank_account=$('#bank_account').val();
			var idcard=$('#idcard').val();
			var bank_mobile=$('#bank_mobile').val();
			if(bank_username==""||card_no==""||bank_account==""||idcard==""){
				layer.msg("请先填写完整提现账号信息!");
				return;
			}
			var property = $("#property").val();
			if(card1==""||card2==""||card3==""||(property!=1&&license=="")||bank_img==""){
				layer.msg("请先上传好相关证件在提交!");
				$('#btn').attr("disabled",false);
				return;
			}
			if(!myreg.test(bank_mobile)){
				layer.msg('请输入有效的手机号码！'); 
				$('#btn').attr("disabled",false);
				return false;
			}
		    var data={
					token	: get_token(),
					uid : getUid(),
					id:getUid(),
					is_credentials:1,
					card1:card1,
					card2:card2,
					card3:card3,
					license:license,
					bank_username:bank_username,
					card_no:card_no,
					bank_account:bank_account,
					idcard:idcard,
					bank_mobile:bank_mobile,
					bank_img:bank_img
				};
		    $.ajax({
				    type: 'post',
				    url: APP.api_url + 'agent/sq',
				    data: data,
				    success: function(data) {
						jump(data.msg,"index.html");
				    }
				});
		})

	</script>
